/*
 * <p>Copyright® 2009-2022 东软 IT 实训中心版权所有。</p>
 */

package com.max.back.doctor.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.max.back.doctor.dao.CheckItemDao;
import com.max.back.doctor.service.CheckItemService;
import com.max.back.entity.CheckItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
* @description 
* 
* <p>
* <code>CheckItemServiceImpl</code>
*
* </p>
* @see 
* @author 辛凤文 forward.seen@foxmail.com
* @version 1.0 
* @time 2022/7/25 22:33 
*/
@Service
public class CheckItemServiceImpl extends ServiceImpl<CheckItemDao,
        CheckItem> implements CheckItemService {

    @Autowired
    private CheckItemDao checkItemDao;

    @Override
    public List<Integer> getCheckCodesByCheckId(String checkId) {
        List<CheckItem> checkItems = list(new QueryWrapper<CheckItem>().eq("CHECK_ID", checkId));
        List<Integer> CheckCodes = checkItems.stream().map(e -> e.getCheckCode()).collect(Collectors.toList());
        return CheckCodes;
    }

    @Override
    public List<Map<String, Object>> getCheckResultInfoByCheckId(String checkId) {
        return checkItemDao.selectCheckItemResultsByCheckId(checkId);
    }
}